<% @page_title = "Profile for #{@user.name}" %>

<%= render :partial => 'home_sidebar' %>

<div class="column span-16">
  <% if not @user.disciplines.empty? %>
    <h4>Your Disciplines</h4>
    <ul>
      <% @user.disciplines.each do |discipline| %>
        <li><%= link_to discipline.name, discipline_path(discipline) %></li>
      <% end %>
    </ul>
  <% end %>

  <% if not @articles.empty? %>
    <h4>Your Articles</h4>
    <ul>
      <% @articles.each do |a| %>
        <li><%= link_to a.title, discipline_article_path(a.discipline, a) %></li>
      <% end %>
    </ul>
    <p><%= link_to "See all of #{user_name_or_text( 'your', "'s" )} articles &#187;", articles_profile_url(@user) %></p>
  <% end %>

  <% if not @user.friends.articles.empty? %>
    <h4>Your Colleague's Articles</h4>
    <ul>
      <% @user.friends.articles.each do |a| %>
      <li><%= link_to "#{a.user.name}: #{a.title}", discipline_article_path(a.discipline, a) %></li>
      <% end %>
    </ul>
  <% end %>

  <% if not @user.disciplines.articles.empty? %>
    <h4>New Articles in Your Disciplines</h4>
    <ul>
      <% @user.disciplines.articles.each do |a| %>
      <li><%= link_to "#{a.discipline.name}: #{a.title}", discipline_article_path(a.discipline, a) %></li>
      <% end %>
    </ul>
  <% end %>
  
  <% if not @user.disciplines.discussions.empty? %>
    <h4>New Discussions in Your Disciplines</h4>
    <ul>
      <% @user.disciplines.discussions.each do |a| %>
        <li><%= link_to "#{a.discipline.name}: #{a.title}", discipline_discussion_path(a.discipline, a) %></li>
      <% end %>
    </ul>
  <% end %>
  <h4>Your Colleagues</h4>

  <% if @user.friends.empty? %>
    <p><%= @user.name %> has not made any connections on pronetos</p>
  <% else %>
    <table class="friend-list" border="0">
      <% @user.friends.in_groups_of(4, false) do |row| %>
        <tr>
          <% row.each do |friend| %>
            <td>
              <%= avatar_for(friend) %>
              <br />
              <%= link_to friend.name, profile_url(friend.login) %>
            </td>
          <% end %>
        </tr>
      <% end %>
    </table>
  <% end %>
</div>
